from numpy import *
import matplotlib.pyplot as plt
from scipy.signal import fftconvolve

def set_ax(plt):
    ax = plt.gca()
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')
    ax.spines['bottom'].set_position(('data', 0))
    ax.spines['left'].set_position(('data', 0))
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')

def f(x):
    return sin(x)
    
def g(x):
    return x

if __name__=='__main__':
    x = arange(-3,3,0.01)
    
    cov = fftconvolve(f(x), g(x))
    plt.plot(f(x),color='b')
    plt.plot(g(x),color='g')
    plt.plot(cov, color='r')
    set_ax(plt)
    plt.show()
    